(send_process_object): Check the process status and
authorKenichi Handa <handa@m17n.org>
Thu, 1 Mar 2007 10:17:41 +0000 (10:17 +0000)
committerKenichi Handa <handa@m17n.org>
Thu, 1 Mar 2007 10:17:41 +0000 (10:17 +0000)
signal an error if something is wrong.

src/process.c

index 7f651e367007edfad36b363fd6c25ddae755dc71..78fc400e5a27d3ebbfd8464cbd2f589dae748578 100644 (file)
@@ -5694,8 +5694,16 @@ send_process_object (proc, start, end)
       : ! NILP (XBUFFER (object)->enable_multibyte_characters))
     {
       struct Lisp_Process *p = XPROCESS (proc);
-      struct coding_system *coding = proc_encode_coding_system[XINT (p->outfd)];
+      struct coding_system *coding;
 
+      if (p->raw_status_new)
+       update_status (p);
+      if (! EQ (p->status, Qrun))
+       error ("Process %s not running", SDATA (p->name));
+      if (XINT (p->outfd) < 0)
+       error ("Output file descriptor of %s is closed", SDATA (p->name));
+
+      coding = proc_encode_coding_system[XINT (p->outfd)];
       if (! EQ (coding->symbol, p->encode_coding_system))
        /* The coding system for encoding was changed to raw-text
           because we sent a unibyte text previously.  Now we are